/**
 * 
 */
package com.leoner.kxhelp.main

import groovy.swing.SwingBuilder
import java.awt.Color
import java.awt.BorderLayout as BL
import javax.swing.WindowConstants as WC
import javax.swing.BorderFactory as BF
import javax.swing.JOptionPane


swing = new SwingBuilder();
login = swing.action(
	name: 'Login',
	closure: this.&loginKx,
	accelerator: 'ctrl L'
)
exit = swing.action(
	name: 'Exit',
	closure: this.&exitKx,
	accelerator: 'ctrl E'
)
frame = swing.frame(title:'KXHelp',
		location:[100,100], size:[600,600],
		defaultCloseOperation:WC.EXIT_ON_CLOSE) {
		panel (border:BF.createEmptyBorder(6,6,6,6)) {
			borderLayout()
			
			vbox (constraints: BL.NORTH){
				labeledSpinner("username",0d);
				textField(id:'username',columns:20)
				labeledSpinner("password",0d);
				passwordField( id:'password',columns:20)
			}
			vbox (constraints: BL.SOUTH){
				button (action: login)
				button (action: exit)
			}

		}
}

frame.pack();
frame.show();

def labeledSpinner(label, value){
	swing.label(label)
	swing.hstrut()
	swing.spinner(id:label, stateChanged:this.&paintGraph,model:swing.spinnerNumberModel(value:value))
}




